package com.base_data_handler.sx.utils;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class WarningLevel {
   	
	// 台风预警
	private static final int tai_feng_baise=48;
	private static final int tai_feng_lanse=24;
	private static final int tai_feng_huangse=24;
	private static final int tai_feng_chengse=12;
	private static final int tai_feng_hongse=6;
	
	// 暴雨预警
	private static final int bao_yu_lanse=12;
	private static final int bao_yu_huangse=6;
	private static final int bao_yu_chengse=3;
	private static final int bao_yu_hongse=3;
	
	// 暴雪预警
	private static final int bao_xue_lanse=12;
	private static final int bao_xue_huangse=12;
	private static final int bao_xue_chengse=6;
	private static final int bao_xue_hongse=6;
	
	// 寒潮预警
	private static final int han_chao_lanse=48;
	private static final int han_chao_huangse=24;
	private static final int han_chao_chengse=24;
	private static final int han_chao_hongse=24;
	
	// 大风预警
	private static final int da_feng_lanse=24;
	private static final int da_feng_huangse=12;
	private static final int da_feng_chengse=6;
	private static final int da_feng_hongse=6;
	
	// 沙尘信号
	private static final int sha_chen_huangse=12;
	private static final int sha_chen_chengse=6;
	private static final int sha_chen_hongse=6;
	
	// 高温信号
	private static final int gao_wen_huangse=72; // 3日
	private static final int gao_wen_chengse=24;
	private static final int gao_wen_hongse=24;
	
	// 干旱信号
	private static final int gan_han_chengse=168; // 一周
	private static final int gan_han_hongse=168;  // 一周
	
	// 雷电信号
	private static final int lei_dian_huangse=6;
	private static final int lei_dian_chengse=2;
	private static final int lei_dian_hongse=2;
	
	// 冰雹信号
	private static final int bing_bao_chengse=6;
	private static final int bing_bao_hongse=2;
	
	// 霜冻信号
	private static final int shuang_dong_lanse=48;
	private static final int shuang_dong_huangse=24;
	private static final int shuang_dong_chengse=24;
	
	// 大雾信号
	private static final int da_wu_huangse=12;
	private static final int da_wu_chengse=6;
	private static final int da_wu_hongse=2;
	
	// 灰霾信号
	private static final int hui_mai_huangse=24;
	private static final int hui_mai_chengse=24;
	private static final int hui_mai_hongse=24;
	
	// 结冰信号
	private static final int jie_bing_huangse=12;
	private static final int jie_bing_chengse=6;
	private static final int jie_bing_hongse=2;
	
	// 火险信号
	private static final int huo_xian_huangse=3;  // 三级
	private static final int huo_xian_chengse=4;  // 四级
	private static final int huo_xian_hongse=5;	   // 五级
	
	// 雷雨大风信号
	private static final int leiyu_dafeng_lanse=6;
	private static final int leiyu_dafeng_huangse=6;
	private static final int leiyu_dafeng_chengse=2;
	private static final int leiyu_dafeng_hongse=2;
	
	
	public static int getWarnOutTime(String type,String color){
		if(type.equals("台风")){
			if(color.equals("白色"))	return tai_feng_baise;
			if(color.equals("蓝色"))	return tai_feng_lanse;
			if(color.equals("黄色"))	return tai_feng_huangse;
			if(color.equals("橙色"))	return tai_feng_chengse;
			if(color.equals("红色"))	return tai_feng_hongse;
		}
		if(type.equals("暴雨")){
			if(color.equals("蓝色"))	return bao_yu_lanse;
			if(color.equals("黄色"))	return bao_yu_huangse;
			if(color.equals("橙色"))	return bao_yu_chengse;
			if(color.equals("红色"))	return bao_yu_hongse;
		}
		if(type.equals("暴雪")){
			if(color.equals("蓝色"))	return bao_xue_lanse;
			if(color.equals("黄色"))	return bao_xue_huangse;
			if(color.equals("橙色"))	return bao_xue_chengse;
			if(color.equals("红色"))	return bao_xue_hongse;
		}
		if(type.equals("寒潮")){
			if(color.equals("蓝色"))	return han_chao_lanse;
			if(color.equals("黄色"))	return han_chao_huangse;
			if(color.equals("橙色"))	return han_chao_chengse;
			if(color.equals("红色"))	return han_chao_hongse;
		}
		if(type.equals("大风")){
			if(color.equals("蓝色"))	return da_feng_lanse;
			if(color.equals("黄色"))	return da_feng_huangse;
			if(color.equals("橙色"))	return da_feng_chengse;
			if(color.equals("红色"))	return da_feng_hongse;
		}
		if(type.equals("沙尘")){
			if(color.equals("黄色"))	return sha_chen_huangse;
			if(color.equals("橙色"))	return sha_chen_chengse;
			if(color.equals("红色"))	return sha_chen_hongse;
		}
		if(type.equals("高温")){
			if(color.equals("黄色"))	return gao_wen_huangse;
			if(color.equals("橙色"))	return gao_wen_chengse;
			if(color.equals("红色"))	return gao_wen_hongse;
		}
		if(type.equals("干旱")){
			if(color.equals("橙色"))	return gan_han_chengse;
			if(color.equals("红色"))	return gan_han_hongse;
		}
		if(type.equals("雷电")){
			if(color.equals("黄色"))	return lei_dian_huangse;
			if(color.equals("橙色"))	return lei_dian_chengse;
			if(color.equals("红色"))	return lei_dian_hongse;
		}
		if(type.equals("冰雹")){
			if(color.equals("橙色"))	return bing_bao_chengse;
			if(color.equals("红色"))	return bing_bao_hongse;
		}
		if(type.equals("霜冻")){
			if(color.equals("蓝色"))	return shuang_dong_lanse;
			if(color.equals("黄色"))	return shuang_dong_huangse;
			if(color.equals("橙色"))	return shuang_dong_chengse;
		}
		if(type.equals("大雾")){
			if(color.equals("黄色"))	return da_wu_huangse;
			if(color.equals("橙色"))	return da_wu_chengse;
			if(color.equals("红色"))	return da_wu_hongse;
		}
		if(type.equals("灰霾")){
			if(color.equals("黄色"))	return hui_mai_huangse;
			if(color.equals("橙色"))	return hui_mai_chengse;
			if(color.equals("红色"))	return hui_mai_hongse;
		}
		if(type.equals("结冰")){
			if(color.equals("黄色"))	return jie_bing_huangse;
			if(color.equals("橙色"))	return jie_bing_chengse;
			if(color.equals("红色"))	return jie_bing_hongse;
		}
		if(type.equals("火险")){
			if(color.equals("黄色"))	return huo_xian_huangse;
			if(color.equals("橙色"))	return huo_xian_chengse;
			if(color.equals("红色"))	return huo_xian_hongse;
		}
		if(type.equals("雷雨大风")){
			if(color.equals("蓝色"))	return leiyu_dafeng_lanse;
			if(color.equals("黄色"))	return leiyu_dafeng_huangse;
			if(color.equals("橙色"))	return leiyu_dafeng_chengse;
			if(color.equals("红色"))	return leiyu_dafeng_hongse;
		}
		
		return 0;
	}
	
	
	@SuppressWarnings("deprecation")
	public static String dateAddHours(int hours,String date){
		SimpleDateFormat sm=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Calendar c=Calendar.getInstance();
		c.setTime(new Date(date));
		//时间加
		c.add(Calendar.HOUR_OF_DAY, hours);
//		int year=c.get(Calendar.YEAR);
//		String month=(c.get(Calendar.MONTH)+1)+"";
//		String day=c.get(Calendar.DAY_OF_MONTH)+"";
//		String hour=c.get(Calendar.HOUR_OF_DAY)+"";
		
		return sm.format(c.getTime());
	}
	
	public static void main(String[] args) {
		dateAddHours(25, "2017/06/27 00:00:00");
	}
	
	
}
